package org.jeecg.modules.veterans.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.system.entity.SysUserCountSta;
import org.jeecg.modules.system.vo.SysNameValueVo;
import org.jeecg.modules.veterans.entity.SysService;
import org.jeecg.modules.veterans.entity.SysServiceDiscount;
import org.jeecg.modules.veterans.entity.SysServicePriority;
import org.jeecg.modules.veterans.mapper.SysServiceMapper;
import org.jeecg.modules.veterans.service.ISysServiceDiscountService;
import org.jeecg.modules.veterans.service.ISysServicePriorityService;
import org.jeecg.modules.veterans.service.ISysServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 优待服务信息表
 * @Author: jeecg-boot
 * @Date:   2022-04-06
 * @Version: V1.0
 */
@Service
public class SysServiceServiceImpl extends ServiceImpl<SysServiceMapper, SysService> implements ISysServiceService {

//    @Resource
//    private SysServiceMapper sysServiceMapper;
    @Autowired
    private ISysServiceDiscountService discountService;
    @Autowired
    private ISysServicePriorityService priorityService;

    @Override
    public SysService getInfoById(String id) {
        SysService item = getById(id);
        QueryWrapper<SysServiceDiscount> wrapper = new QueryWrapper<>();
        wrapper.eq("service_id",id);
        List<SysServiceDiscount> discounts = discountService.list(wrapper);
        item.setDiscounts(discounts);
        QueryWrapper<SysServicePriority> wrapper1 = new QueryWrapper<>();
        wrapper1.eq("service_id",id);
        List<SysServicePriority> priorities = priorityService.list(wrapper1);
        item.setPriorities(priorities);
        return item;
    }

    @Override
    public List<SysNameValueVo> serviceType() {
        return baseMapper.serviceType();
    }

    @Override
    public SysUserCountSta userCount() {
        return baseMapper.userCount();
    }

    @Override
    public List<SysNameValueVo> serviceArea() {
        return baseMapper.serviceArea();
    }


}
